package com.yuchengtech.test.pack.action;

import com.wox.action.JsonData;
import com.wox.action.WoxAction;
import com.yuchengtech.fileUtil.FileUtil;

public class PackFileAction extends WoxAction {

	private String webInfDir;
	private	String srcFile;
	private String destDir;

	



	@Override
	public String excute() throws Exception {

		JsonData data=getJsonData();
		if(webInfDir!=null&&webInfDir.trim().length()>0
				&&srcFile!=null&&srcFile.trim().length()>0
				&&destDir!=null&&destDir.trim().length()>0)
		{
		boolean b=FileUtil.copyFile(FileUtil.contactPath(webInfDir,srcFile),FileUtil.contactPath(destDir,srcFile));
		data.setState(b);
		if(b)
		{
			data.setMessage("单个文件复制成功");
		}else
			{
			data.setMessage("Sorry(-_-),文件复制失败!");
			}
		}else
		{
			data.setMessage("Sorry(-_-),参数有误!");
		}
		
		return JSONBACK;
	}
	
	
	public void setWebInfDir(String webInfDir) {
		this.webInfDir = webInfDir;
	}


	public void setSrcFile(String srcFile) {
		this.srcFile = srcFile;
	}


	public void setDestDir(String destDir) {
		this.destDir = destDir;
	}



}
